package com.cjkj.applet.controller;

import com.cjkj.applet.service.TJ02ReportService;
import com.cjkj.common.core.web.domain.AjaxResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 多参数监测仪小程序健康报告
 */
@RestController
@RequestMapping("/bracelet/report")
@Validated
public class HealthReportBraceletController {

    @Resource
    private TJ02ReportService tj02ReportService;

    /**
     * 心率
     * @param visitNo 患者就诊号
     */
    @GetMapping("/heart")
    public AjaxResult getHeartReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj02ReportService.getBraceletHeartReport(visitNo);
    }

    /**
     * 体温
     * @param visitNo 患者就诊号
     */
    @GetMapping("/temperature")
    public AjaxResult getBreatheReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj02ReportService.getBraceletTemperatureReport(visitNo);
    }

    /**
     * 血氧报告
     * @param visitNo 患者就诊号
     */
    @GetMapping("/spo2")
    public AjaxResult getSpo2Report(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj02ReportService.getBraceletSpo2Report(visitNo);
    }

    /**
     * 获取患者监测报告
     * @return
     */
    @GetMapping("getPatientReportData")
    public AjaxResult getPatientReportData(@NotBlank(message = "就诊号不能为空！") String visitNos,
                                           @NotBlank(message = "打印项目不能为空！") String reportItems) {
        return tj02ReportService.getTJ02ReportData(visitNos, reportItems);
    }

}
